package com.whpost.service.dao.cwqf;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whpost.service.entity.cwqf.HsCzy;
import com.whpost.service.entity.cwqf.HsJg;
import com.whpost.service.entity.cwqf.OrgCountDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author YinZhuoyi
 * @since 2025-08-29
 */
public interface HsJgMapper extends BaseMapper<HsJg> {

    @Select("<script>" +
            "<![CDATA[" +  // 开始包裹纯 SQL 片段（不含动态标签）
            "SELECT " +
            "* " +
            "FROM hs_jg h " +
            "WHERE h.jb = 2 " +
            "AND h.zybz = '1' " +
            "]]>" +  // 结束包裹纯 SQL 片段
            // 动态标签单独放在 CDATA 外面（避免被忽略）
            "<if test='lshList != null and lshList.size() > 0'> " +
            "AND h.lsh IN " +
            "<foreach collection='lshList' item='lsh' open='(' close=')' separator=','> " +
            "#{lsh} " +
            "</foreach> " +
            "</if> " +
            "<![CDATA[" +  // 继续包裹剩余纯 SQL
            "ORDER BY h.xh" +
            "]]>" +
            "</script>")
    List<HsJg> czyGljg2(
            @Param("lshList") List<Integer> lshList  // 确保参数名与 SQL 中一致
    );

}
